﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using BaseEntities;

namespace DataAccess
{
    public class ViewHistoryAccess
    {
        public DataTable ViewHistory(string CardNo, int Ngay)
        {
            DataTable datatable = new DataTable();
            SqlDataAdapter dataset = new SqlDataAdapter();
            try
            {
                using (SqlConnection con = DBConnect.GetConnection())
                {
                    using (SqlCommand cmd = new SqlCommand("SP_gridview_paging_UCViewHitory", con))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.Add("@CardNo", SqlDbType.VarChar).Value = CardNo;
                        cmd.Parameters.Add("@Ngay", SqlDbType.VarChar).Value = Ngay;
                        dataset.SelectCommand = cmd;
                        dataset.Fill(datatable);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
            return datatable;
        }
    }
}
